import java.applet.*;
import java.awt.*;

public class FigureChange extends Applet {
	FigureCanvas square;
	TextSlideF velField;  
	TextSlideF posField;  
	double minVal = -1.0, maxVal = 1.0;  

	public void init() {
		this.setLayout(new BorderLayout(15,15));
		Panel p = new Panel();
		p.setLayout(new GridLayout(2,1,0,4));
		velField = new TextSlideF(this,"Velocity:",minVal,maxVal);
		p.add(velField);
		posField = new TextSlideF(this,"Vertical Position:",-100,100);
		p.add(posField);
		add("South",p);
		square = new FigureCanvas();
		this.add("Center",square);
		velField.setValue(0.0);
		posField.setValue(0.0);
		validate();
	}

	public void start() { 
		square.enable();
	}

	public void stop() { 
		square.disable();
	}

	public void changeParam(TextSlideF which) {
		if (which == velField) {
			square.setVelocity(velField.getValue());
		} 
		else if (which == posField) {
			square.setPosition(posField.getValue());
		} 
	}

	public void paint(Graphics g) {
		;
	}

	// Keep a main around in case we want to debug without an html page.
	// This could be greatly improved or deleted.  Either is appropriate.ff
	public static void main(String args[]) {
		Applet applet = new FigureChange();
		Frame f = new Frame("FigureChange");
		f.add("Center",applet);
		applet.init();
		applet.start();
	}

}
